package com.orbitdevs.testgame.graphics;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class SpriteSheet {
	public Texture texture;
	
	public SpriteSheet(String path){
		this.texture = new Texture(Gdx.files.internal(path));
	}
	
	public TextureRegion getTexture(int x, int y, int size){
		return new TextureRegion(this.texture,x*size,y*size,size,size);
	}
	
	public TextureRegion[][] getTexArray(int x, int y, int size, int rows, int cols){
		TextureRegion[][] textures = new TextureRegion[rows][cols];
		for(int i = 0; i < rows; i++){
			for(int j = 0; j < cols; j++){
				textures[i][j] = getTexture(x + i, y + j, size);
			}
			
		}
		return textures;
	}
}
